package com.newer.textdbnotepad.sdk

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Inject

/**加解密接口*/
interface SecurityInterface {
    /**加密*/
    suspend fun encode(content: String): String

    /**解密*/
    suspend fun decode(content: String): String
}

/**
 * 空实现
 * 不加密直接原字符串
 * */
class EmptySecurityInterface @Inject constructor() : SecurityInterface {
    override suspend fun encode(content: String) = content
    override suspend fun decode(content: String) = content
}


@Module
@InstallIn(SingletonComponent::class)
abstract class SecurityInterfaceModule {
    @Binds
    abstract fun bindSecurityInterface(securityInterface: EmptySecurityInterface): SecurityInterface
}